import java.util.LinkedList;
import java.util.List;


public class Knoten {
	
	private final int id;
	private final int capacity;
	private Mash mash;
	

//	private java.util.List<Knoten> nachfolger;
	private java.util.List<Knoten> vorganger;
	
	public Knoten(int id, int cap){
		this.id = id;
		this.capacity = cap;
//		nachfolger = new LinkedList<Knoten>();
		vorganger = new LinkedList<Knoten>();
	}

//	public void addNf(Knoten nf){
//		if (nf==null)throw new IllegalArgumentException("nachfolger null");
//		this.nachfolger.add(nf);
//	}
	
	public void addPre(Knoten vg){
		if (vg==null)throw new IllegalArgumentException("vorganger null");
		this.vorganger.add(vg);
	}
	
//	public List<Knoten> getPost(){
//		return this.nachfolger;
//	}

	@Override
	public int hashCode() {
		return capacity + id;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Knoten other = (Knoten) obj;
		if (capacity != other.capacity)
			return false;
		if (id != other.id)
			return false;
		return true;
	}

	public int getId() {
		return id;
	}

	public int getCapacity() {
		return capacity;
	}

	public Mash getMash() {
		return mash;
	}

	public void setMash(Mash mash) {
		this.mash = mash;
	}

	public java.util.List<Knoten> getVorganger() {
		return vorganger;
	}
	@Override
	public String toString() {
		StringBuffer s= new StringBuffer();
		s.append("[");
//		s.append(this.id);
		s.append("Cap: ");
		s.append(this.capacity);
		s.append(" ");
		s.append("]");
		return s.toString();
	}
}
